Skip to content

Move OpenCode/Pi plugin install into code-trace setup - #13

Closed
winjer wants to merge 1 commit into
setup-subcommand-write-configfrom
setup-subcommand-plugins
Closed

Move OpenCode/Pi plugin install into code-trace setup#13
winjer wants to merge 1 commit into
setup-subcommand-write-configfrom
setup-subcommand-plugins

Conversation

@winjer

@winjer winjer commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Stacked on #12 (which is stacked on #11). Merge order: #11#12 → this. GitHub retargets each to main as its base merges.

Final slice of the installer migration: agent plugin/extension install moves out of install.sh into the binary.

What changed

  • src/setup.rs embeds the plugin sources with include_str!, so plugin install now works under curl | bash — where there's no local checkout to copy from and the old shell path silently skipped ("Plugin source not found"). New flags: --install-opencode, --offer-opencode, --install-pi, --offer-pi. Detection, the y/N prompt (read from /dev/tty in-process, so it can't consume the piped script), and the write are all Rust and unit-tested.
  • install.sh shrinks from 365 → 173 lines. Gone: plugin-source resolution, the copy helpers, agent detection, the TTY_IN/resolve_tty_in machinery, and the last bash read prompts. It's now a bootstrap — detect platform, download binary, set PATH — that hands off to code-trace setup for every configuration step.
  • Tests — 5 new unit tests (embedded sources present, plugin paths, detection, install write) + 4 integration tests driving the real binary (install writes the embedded source and it byte-matches the repo file; offer skips cleanly when the agent isn't detected).

Verification

  • cargo test (108 lib incl. 29 setup + 16 integration) and cargo clippy --all-targets clean.
  • End to end through a piped curl | bash simulation with OpenCode present: the plugin is offered, installed from the embedded source, and the email prompt still works — all in one run.

Where this leaves install.sh

It's now a thin bootstrap. Every fragile, growing piece — JSON hook editing, config writing, prompts, plugin install — lives in the tested binary. python3 is gone; no interpreter is required. The three prompt/read bugs we chased earlier can't recur, because prompts run in a separate process reading /dev/tty rather than in a shell reading the piped script.

🤖 Generated with Claude Code

Final slice of the installer migration: agent plugin/extension install
moves from install.sh into the binary as `code-trace setup
--install-opencode | --offer-opencode | --install-pi | --offer-pi`.

- src/setup.rs embeds the plugin sources with include_str!, so install
  works under curl | bash — where there is no local checkout to copy
  from and the old shell path silently skipped. Detection, the y/N
  prompt (read from /dev/tty in-process, so it can't consume the piped
  script), and the write are all in Rust and unit-tested.
- install.sh shrinks from 365 to 173 lines: the plugin-source
  resolution, copy helpers, agent detection, the TTY_IN/resolve_tty_in
  machinery, and the remaining bash prompts are all gone. It is now a
  bootstrap (detect platform, download binary, PATH) that hands off to
  `code-trace setup` for every configuration step.
- Tests: 5 new unit tests (embedded sources, plugin paths, detection,
  install write) + 4 integration tests driving the real binary
  (install writes the embedded source; offer skips when not detected).

Verified end to end through a piped curl | bash simulation with OpenCode
present: the plugin is offered, installed from the embedded source, and
the email prompt still works — all in one run.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@winjer

winjer commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #14, which collapses #11#13 into a single commit against main (and fixes the harness Docker build to copy plugin/ for the new include_str!).

@winjer winjer closed this Jul 20, 2026
@winjer
winjer deleted the setup-subcommand-plugins branch July 20, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant